<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class MailTest extends Command
{

    protected $signature = 'mail:test';


    protected $description = '邮件测试';



    public function handle()
    {

        # 默认使用driver: SMTP
        $res = \Mail::send(
            'mail/log', //邮件模板
            ['log' => '这是一个测试邮件，内容：嘻嘻嘻嘻嘻嘻嘻'],
            function($message) use(&$log){
                $message
                    ->to('1039289613@qq.com')
                    ->attach(storage_path('app/users.xlsx'), ['as'=> '附件1.xlsx'])
                    ->subject('邮件主题：测试 ');
        });


        \Log::info('邮件发送成功'.$res);

    }
}
